package Tool;

import Javabean.Staff;

import java.util.ArrayList;

public class Arraylist_Staff_Update {
    public static void staffUpdate(ArrayList<Staff> staffs, Staff staff, int Id) {

        //转化
        int marry;
        if(staff.isMarry().equals("已婚")){
            marry = 1;
        }else {
            marry = 0;
        }

        //根据传入的职工Id和staff对象，更改传入的集合staffs中职工ID相对应的职工
        staffs.get(Id - 1).setName(staff.getName());
        staffs.get(Id - 1).setSex(staff.getSex());
        staffs.get(Id - 1).setBrithday(staff.getBrithday());
        staffs.get(Id - 1).setAge(staff.getAge());
        staffs.get(Id - 1).setMarry(marry);
        staffs.get(Id - 1).setPlace(staff.getPlace());
        staffs.get(Id - 1).setLevel(staff.getLevel());
        staffs.get(Id - 1).setSalary(staff.getSalary());

    }
}
